package com.example.demo.controller.AuthorControl;

import com.example.demo.entity.BackResponseEntity;
import com.example.demo.entity.requestJson.AInsertLabelReq;
import com.example.demo.entity.responseJson.AQueryLabelRes;
import com.example.demo.entity.responseJson.ListResult;
import com.example.demo.service.ALabelService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : 杨丽辉
 * @date : 2021/3/1 14:50
 * @description:
 */
@RestController
@RequestMapping("/author/label")
@Api(value = "标签接口", tags = "标签接口")
public class ALabelController {
    @Autowired
    private ALabelService aLabelService;

    @ApiOperation(value = "管理添加二级标签", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )

    @PostMapping("/insertwolabel")
    public BackResponseEntity<Object> insertTwoLabel(@RequestBody AInsertLabelReq aInsertLabelReq) {
        return aLabelService.insertTwoLabel(aInsertLabelReq);
    }

    @ApiOperation(value = "推荐二级标签", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )

    @GetMapping("/querytwolabel")
    public BackResponseEntity<ListResult<List<AQueryLabelRes>>> queryTwoLabel() {
        return aLabelService.queryTwoLabel();
    }

    @ApiOperation(value = "管理添加一级标签", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )

    @PostMapping("/inseronelabel")
    public BackResponseEntity<Object> insertOneLabel(@RequestBody AInsertLabelReq aInsertLabelReq) {
        return aLabelService.insertTwoLabel(aInsertLabelReq);
    }

    @ApiOperation(value = "推荐一级标签", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )

    @GetMapping("/queryonelabel")
    public BackResponseEntity<ListResult<List<AQueryLabelRes>>> queryOneLabel() {
        return aLabelService.queryOneLabel();
    }
}
